package com.fdd.furns.dao.impl;

import com.fdd.furns.dao.BasicDAO;
import com.fdd.furns.dao.OrderDAO;
import com.fdd.furns.pojo.Order;

import java.util.Collections;
import java.util.List;

public class OrderDAOImpl extends BasicDAO implements OrderDAO {

    @Override
    public int saveOrder(Order order) {
        String sql = "insertx into `order`(`id`,`create_time`,`price`,`status`,`member_id`) values(?,?,?,?,?)";
        return update(sql, order.getId(), order.getCreateTime(), order.getPrice(), order.getStatus(), order.getMemberId());
    }

    @Override
    public List<Order> getOrderByMemberId(Integer memberId) {
        String sql = "select `id`, create_time as createTime, `price`, `status`, `member_id` as memberId from `order` where `member_id` = ?";
        return queryMulti(sql, Order.class, memberId);
    }
}
